import { createRouter, createWebHistory } from 'vue-router';
import Sidebar from '../components/Sidebar.vue';
import DataAggregationMonitor from '/src/views/data-aggregation/monitor.vue';
import DataAggregationStorage from '/src/views/data-aggregation/storage.vue';
import DataGovernanceBoard from '/src/views/data-governance/board.vue';
import DataGovernanceProcess from '/src/views/data-governance/process.vue';
import MultimodalAnalysisModel from '/src/views/multimodal-analysis/mode.vue';
import MultimodalAnalysisFeature from '/src/views/multimodal-analysis/feature.vue'
import MultimodalAnalysisAnalyse from '/src/views/multimodal-analysis/analyse.vue'
import ParentLayout from '/src/layouts/ParentLayout.vue'  // 更新导入路径
import ScenarioSimulationHome from '../views/scenario-simulation/home.vue'  // 导入剧情编辑工作台组件
import ScenarioSimulationList from '../views/scenario-simulation/list.vue'  // 导入仿真推演控制台组件
import ScenarioSimulationDetail from '../views/scenario-simulation/detail.vue'  // 导入数据集工厂页面组件
import SystemManagementHome from '../views/system-management/home.vue'  // 导入流程监控中心组件
import SystemManagementList from '../views/system-management/list.vue'  // 导入安全审计页面组件
import SystemManagementDetail from '../views/system-management/detail.vue'  // 导入数据目录导航器组件

import FlightFlightMonitor from '@/views/data-aggregation/FlightDataMonitor/FlightDataMonitor.vue'
import SignalAnalyzer from "@/views/data-aggregation/SignalAnalyzer/SignalAnalyzer.vue";
import AnalysisFeature from "@/views/multimodal-analysis/AnalysisFeature/AnalysisFeature.vue";

// 为每个模块导入或动态加载页面组件

const DataGovernanceHome = { template: '<div>数据治理 - 首页</div>' };


import SearchEngineHome from '../views/search-engine/home.vue'  // 导入多维检索中心组件
import SearchEngineList from '../views/search-engine/list.vue'  // 导入结果处理工作区组件
import SearchEngineDetail from '../views/search-engine/detail.vue'  // 导入知识图谱透视页面

import VisualizationHome from '../views/visualization/home.vue'  // 导入电磁态势总览页面
import VisualizationList from '../views/visualization/list.vue'  // 导入信号分析实验室页面
import VisualizationDetail from '../views/visualization/detail.vue'  // 导入威胁评估驾驶舱页面

// SystemManagementHome、SystemManagementList 和 SystemManagementDetail 已在上方导入

// ScenarioSimulationHome、ScenarioSimulationList 和 ScenarioSimulationDetail 已在上方导入

const routes = [
  {
    path: '/',
    redirect: '/data-aggregation/monitor'
  },
  {
    path: '/sidebar',
    name: 'Sidebar',
    component: Sidebar,
  },





  {
    path: '/data-aggregation',
    redirect: '/data-aggregation/monitor',
    component: ParentLayout,  // 使用统一父组件
    children: [
      { path: 'monitor', component: FlightFlightMonitor },
      { path: 'storage', component: SignalAnalyzer }
    ]
  },
  {
    path: '/data-governance',
    redirect: '/data-governance/home',
    component: ParentLayout,  // 使用统一父组件
    children: [
      { path: 'home', component: DataGovernanceHome },
      { path: 'board', component: DataGovernanceBoard },
      { path: 'process', component: DataGovernanceProcess }
    ]
  },
  {
    path: '/multimodal-analysis',
    redirect: '/multimodal-analysis/model',
    component: ParentLayout,  // 使用统一父组件
    children: [
        { path: 'home', component: AnalysisFeature },
      { path: 'model', component: MultimodalAnalysisModel },
      { path: 'feature', component: MultimodalAnalysisFeature },
      { path: 'analyse', component: MultimodalAnalysisAnalyse }
    ]
  },
  {
    path: '/search-engine',
    redirect: '/search-engine/home',
    component: ParentLayout,  // 使用统一父组件
    children: [
      { path: 'home', component: SearchEngineHome },  // 多维检索中心作为嵌套路由
      { path: 'list', component: SearchEngineList },  // 结果处理工作区作为嵌套路由
      { path: 'detail', component: SearchEngineDetail }  // 知识图谱透视页面作为嵌套路由
    ]
  },
  {
    path: '/visualization',
    redirect: '/visualization/home',
    component: ParentLayout,  // 使用统一父组件
    children: [
      { 
        path: 'home', 
        name: 'ElectromagneticOverview',
        component: VisualizationHome  // 电磁态势总览页面
      },
      { 
        path: 'list', 
        name: 'SignalAnalysisLab',
        component: VisualizationList  // 信号分析实验室页面
      },
      { 
        path: 'detail', 
        name: 'ThreatAssessmentCockpit',
        component: VisualizationDetail  // 威胁评估驾驶舱页面
      }
    ]
  },
  {
    path: '/system-management',
    redirect: '/system-management/home',
    component: ParentLayout,  // 使用统一父组件
    children: [
      { 
        path: 'home', 
        name: 'ProcessMonitorCenter',
        component: SystemManagementHome  // 流程监控中心作为嵌套路由
      },
      { 
        path: 'list', 
        name: 'SecurityAuditCenter',
        component: SystemManagementList  // 安全审计页面作为嵌套路由
      },
      { 
        path: 'detail', 
        name: 'DataNavigator',
        component: SystemManagementDetail  // 数据目录导航器作为嵌套路由
      }
    ]
  },
  // 场景仿真嵌套路由（完全仿照search-engine模块）
  {
    path: '/scenario-simulation',
    redirect: '/scenario-simulation/home',
    component: ParentLayout,  // 使用统一父组件
    children: [
      { path: 'home', component: ScenarioSimulationHome },  // 剧情编辑工作台
      { path: 'list', component: ScenarioSimulationList },  // 仿真推演控制台
      { path: 'detail', component: ScenarioSimulationDetail }  // 数据集工厂
    ]
  }
];

const router = createRouter({
  history: createWebHistory('/'),
  routes,
});

export default router;